/**
 * MarioEnemy
 * @extends GamePawn
 * @version 2010.12.03
 */

class MarioEnemy extends GamePawn 
	abstract 
	placeable;
   
var(NPC) StaticMeshComponent NPCMesh;
var(Patrolling) array<NavigationPoint> MyPatrollPoints;
var MarioAI MyController;
var Vector spawnPoint;
var StaticMeshComponent shell;

var (Turtle) array<NavigationPoint> MyNavigationPoints;

//override to do nothing
simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info) { }
//Is this necessary?
function addComponents() { }

/**
 * Bump
 * @version 2010.12.03
 */
event Bump(Actor Other, PrimitiveComponent OtherComp, vector HitNormal)
{
	 local GamePawn HitPawn;
	 HitPawn = GamePawn(Other);

	 if(round(HitNormal.Z) == 1.00) 
	 {
	 	`log("Hit on top!");

		//Why LinkPlasma? Just for testing?
		TakeDamage(50, HitPawn.Controller, HitPawn.Location, vect(1, 1, 1), class'UTDmgType_LinkPlasma');

		//Destroy();
		if(HitPawn.isPlayerPawn()) 
		{
			`log("I make player jump!");
			HitPawn.DoJump(FALSE);
		}
		
		if(Health <= 50 && Health > 10)
		{
			`log("ME IS A SHELL");
			addComponents();
			Velocity.X = 0;
			Velocity.Y = 0;
			Acceleration = vect(0,0,0);
		}
	}
	else if(HitPawn.isPlayerPawn() && round(HitNormal.Z) != 1.00 && HitPawn.Location.Z - Location.Z <= GetCollisionHeight()) 
	{
		`log("I KEEL YOU");
		
		if(HitPawn.Health > 100 && HitPawn.Health <= 150)
			HitPawn.ThrowActiveWeapon(true);
		else if(HitPawn.Health >50 && HitPawn.Health <=100)
			MarioPawn(HitPawn).ShrinkHeight();
		//HitPawn.SetActiveWeapon(None);
		`log("health: "$MarioPawn(Other).Health);
		HitPawn.TakeDamage(50, Controller, Location, vect(1, 1, 1), class'UTDmgType_LinkPlasma');
		`log("health: "$MarioPawn(Other).Health);
		//HitPawn.Suicide();	
	} 
}

state Dead
{
	Begin:
		Destroy();
}

defaultproperties
{
	bCollideWorld   = TRUE;
	bBlockActors    = TRUE;
	bCollideComplex = TRUE;
	Health          = 50;
	JumpZ           = 700;
	
	Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
		ModShadowFadeoutTime        = 0.25;
		MinTimeBetweenFullUpdates   = 0.20;
		AmbientGlow                 = (R = .01, G = .01, B = .01, A = 1.0);
		AmbientShadowColor          = (R = .15, G = .15, B = .15);
		LightShadowMode             = LightShadow_ModulateBetter;
		ShadowFilterQuality         = SFQ_High;
		bSynthesizeSHLight          = TRUE;
	End Object
	Components.Add(MyLightEnvironment)
	
	Components.Remove(Sprite)
	Components.Remove(Sprite)
			
	CollisionType = COLLIDE_BlockAll
	Begin Object Name=CollisionCylinder
		CollisionRadius = +0010.000000;
		CollisionHeight = +0040.000000;
	End Object
	CylinderComponent = CollisionCylinder
	
}
